<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>平台管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="__STATIC__/res/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__STATIC__/res/adminui/dist/css/admin.css" media="all">
    <style>
        .form-submit{
            margin:0px 15px 0 15px;
            padding-top: 15px;
            padding-left: 15px;
            position: fixed;
            bottom: 0;
            left: 0;
            z-index: 5;
            background: #fff;
            width: 100%;
        }
        .layui-upload-img{
            with: 50px;
        }
    </style>
</head>
<body style="margin-bottom: 50px;">

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">

                    <div class="layui-card-body" pad15>
                        <form class="layui-form" lay-filter="">
                            <div class="layui-form-item">
                                <label class="layui-form-label"> 商户名称</label>
                                <div class="layui-input-block" style="width: 35%">
                                    <input type="text" name="username" disabled readonly autocomplete="off" class="layui-input" value="{$merchant.username}">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label"><span style="color: #FF5722">*</span> 新密码</label>
                                <div class="layui-input-block" style="width: 35%">
                                    <input type="password" name="password" lay-verify="required" placeholder="请输入密码" lay-reqtext="请输入密码" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label"><span style="color: #FF5722">*</span> 确认密码</label>
                                <div class="layui-input-block" style="width: 35%">
                                    <input type="password" name="confirm_password" lay-verify="required" placeholder="请输入确认密码" lay-reqtext="请输入确认密码" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                            <div class="form-submit">
                                <div class="layui-form-item">
                                    <div class="layui-input-black">
                                        <input type="button" lay-submit lay-filter="layuiadmin-app-form-edit"
                                               id="layuiadmin-app-form-edit"
                                               value="保存" class="layui-btn">
                                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                    </div>
                                </div>
                            </div>

                        </form>

                    </div>

                </div>
            </div>
        </div>
    </div>


<script>
    var MERCHANT_DO_PWS_URL = '{:url("merchant/doPwd")}'
</script>
<script src="__STATIC__/res/layui/layui.js"></script>
<script>
    layui.config({
        base: '__STATIC__/res/' //静态资源所在路径
    }).use(['element', 'index', 'form', 'laydate', 'upload','element'], function () {
        var $ = layui.$
            , form = layui.form
            ,laydate = layui.laydate
            ,element = layui.element
            ,upload = layui.upload;

        //监听提交
        form.on('submit(layuiadmin-app-form-edit)', function (data) {
            var field = data.field; //获取提交的字段
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            console.log(field)

            //提交 Ajax 成功后，关闭当前弹层并重载表格
            $.ajax({
                method: 'post',
                data: field,
                url: MERCHANT_DO_PWS_URL,
                success: function (res) {
                    if (res.result.status) {
                        layer.msg(res.result.msg, {
                            offset: '15px'
                            , icon: 2
                            , time: 1000
                        });
                        return
                    }
                    layer.msg(res.result.msg, {
                        offset: '15px'
                        , icon: 1
                        , time: 1000
                    },function (){
                        window.location.reload(true)
                    });
                }
            });
        });

    })

</script>
</body>
</html>